package com.shd.edanpei.ui.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseViewHolder;
import com.shd.edanpei.R;
import com.shd.edanpei.base.BaseQuickImageAdapter;
import com.shd.edanpei.bean.TeamOrderModel;
import com.shd.edanpei.enums.OrderTypeEnum;

public class TeamAdapter extends BaseQuickImageAdapter<TeamOrderModel> {
    public TeamAdapter(Context context) {
        super(context, R.layout.item_team);
    }

    @Override
    protected void convert(BaseViewHolder helper, TeamOrderModel item) {

        ImageView ivType = helper.getView(R.id.iv_type);
        if (item.getOrderType() == OrderTypeEnum.car.getKey()) {
            ivType.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_label_car));
        } else if (item.getOrderType() == OrderTypeEnum.house.getKey()) {
            ivType.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_label_house));
        } else if (item.getOrderType() == OrderTypeEnum.normal.getKey()) {
            ivType.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_label_common));
        } else if (item.getOrderType() == OrderTypeEnum.personal.getKey()) {
            ivType.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.xinyong));
        } else if (item.getOrderType() == OrderTypeEnum.enterprise.getKey()) {
            ivType.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.qiye));
        }

        helper.setText(R.id.tv_name, item.getCreateUserName())
                .setText(R.id.tv_amount, item.getLastAmount())
                .setText(R.id.tv_rebate, item.getReturnAmontStr())
                .setText(R.id.tv_time, item.getFirmLoanTime());
    }

}
